<template>
    <div>

        <!--导航栏-->
        <div style="position: fixed;z-index: 10;width: 100%">
            <van-nav-bar  title="AddressNew" left-text="" left-arrow @click-left="onClickLeft()">
                <template #right>
                    <van-icon name="search" size="18" />
                </template>
            </van-nav-bar>
        </div>
        <div style="height: 50px"></div>

        <van-address-edit
                :area-list="areaList"
                show-postal
                show-delete
                show-set-default
                show-search-result
                :search-result="searchResult"
                :area-columns-placeholder="['请选择', '请选择', '请选择']"
                @save="onSave"
                @delete="onDelete"
                @change-detail="onChangeDetail"
        />

    </div>
</template>

<script>
    import area from "../../assets/area";
    export default {
        name: "AddressNew",
        data() {
            return {
                areaList: area,
                searchResult: [],
            };
        },
        methods: {
            onClickLeft(){
                this.$router.back();
            },
            onSave() {
                this.$router.back();
            },
            onDelete() {
                this.$router.back();
            },
            onChangeDetail(val) {
                if (val) {
                    this.searchResult = [
                        {
                            name: '黄龙万科中心',
                            address: '杭州市西湖区',
                        },
                    ];
                } else {
                    this.searchResult = [];
                }
            },

        },
        mounted() {
            console.log("==>AddressNew")
        }
    }
</script>

<style scoped>

</style>